<?php
error_reporting(0);
if(!defined('IN_DISCUZ')){
	exit('Access Denied');
}

class plugin_tianchai_youku{

	function discuzcode($param){
		require_once libfile('function/cache');
		global $_G;			
		if(!isset($_G['cache']['plugin']['tianchai_youku'])){
				loadcache('plugin');
		}

		$codewidth = $_G['cache']['plugin']['tianchai_youku']['codewidth'];
		$codeheight = $_G['cache']['plugin']['tianchai_youku']['codeheight'];
		
		if($param['caller'] == 'discuzcode')
		{	

			$_G['discuzcodemessage'] = str_replace("[tianchai_youku]",'<embed src="http://static.youku.com/v1.0.0223/v/swf/loader.swf?winType=adshow&amp;VideoIDS=',$_G['discuzcodemessage']);
			$_G['discuzcodemessage'] = str_replace("[/tianchai_youku]",'&amp;isAutoPlay=false&amp;delayload=false&amp;isShowRelatedVideo=false&amp" width="'.$codewidth.'" height="'.$codeheight.'" border="0" align="center" wmode="transparent" allowfullscreen="true"></embed>',$_G['discuzcodemessage']);

			
			//<embed type="application/x-shockwave-flash" src="http://static.youku.com/v1.0.0227/v/swf/player.swf" width="810" height="570" bgcolor="#FFFFFF" quality="high" wmode="transparent" allowfullscreen="true" flashvars="VideoIDS={1}&amp;playMovie=true&amp;winType=index&amp;isAutoPlay=false&amp;auto=1&amp;allowFullScreen=true" pluginspage="http://www.macromedia.com/go/getflashplayer">

		
			//$_G['discuzcodemessage'] = str_replace("XNTI0MjY2MzU2",$_G['discuzcodemessage'],'<div id="player" style="width: 434px; height: 340px; display: block;"><object type="application/x-shockwave-flash" data="http://player.youku.com/player.php/sid/XNTI0MjY2MzU2/partnerid/e208b9635f53e934/v.swf" width="100%" height="100%" id="youku-player"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><param name="movie" value="http://player.youku.com/player.php/sid/XNTI0MjY2MzU2/partnerid/e208b9635f53e934/v.swf"><param name="flashvars" value="imglogo=&amp;paid=0&amp;partnerId=e208b9635f53e934&amp;isAutoPlay=false&amp;isShowRelatedVideo=false"></object></div>');

			//$_G['discuzcodemessage'] = str_replace("XNTI0MjY2MzU2",$_G['discuzcodemessage'],'<object type="application/x-shockwave-flash" data="http://static.youku.com/v1.0.0223/v/swf/loader.swf?winType=adshow&amp;VideoIDS=XNTI0MjY2MzU2&amp;isAutoPlay=true&amp;delayload=true&amp;isShowRelatedVideo=false&amp;" width="280" height="224"><param name="wmode" value="transparent"><param name="movie" value="http://static.youku.com/v1.0.0223/v/swf/loader.swf?winType=adshow&amp;VideoIDS=XNTI0MjY2MzU2&amp;isAutoPlay=true&amp;delayload=true&amp;isShowRelatedVideo=false&amp;" width="280" height="224"><embed src="http://static.youku.com/v1.0.0223/v/swf/loader.swf?winType=adshow&amp;VideoIDS=XNTI0MjY2MzU2&amp;isAutoPlay=true&amp;delayload=true&amp;isShowRelatedVideo=false&amp;" width="280" height="224" border="0" align="center" wmode="transparent"></object>');

			
			//$_G['discuzcodemessage'] = str_replace("XNTI0MjY2MzU2",$_G['discuzcodemessage'],'<object type="application/x-shockwave-flash" data="http://static.youku.com/v1.0.0223/v/swf/loader.swf?winType=adshow&amp;VideoIDS=XNTI0MjY2MzU2&amp;isAutoPlay=true&amp;delayload=true&amp;isShowRelatedVideo=false&amp;imglogo=http://static.atm.youku.com/Youku2013/201303/0320/22112/280210.jpg" width="750" height="560"><param name="wmode" value="transparent"><param name="movie" value="http://static.youku.com/v1.0.0223/v/swf/loader.swf?winType=adshow&amp;VideoIDS=XNTI0MjY2MzU2&amp;isAutoPlay=true&amp;delayload=true&amp;isShowRelatedVideo=false&amp;imglogo=http://static.atm.youku.com/Youku2013/201303/0320/22112/280210.jpg" width="750" height="560"><embed src="http://static.youku.com/v1.0.0223/v/swf/loader.swf?winType=adshow&amp;VideoIDS=XNTI0MjY2MzU2&amp;isAutoPlay=true&amp;delayload=true&amp;isShowRelatedVideo=false&amp;imglogo=http://static.atm.youku.com/Youku2013/201303/0320/22112/280210.jpg" width="750" height="560" border="0" align="center" wmode="transparent"></object>');
		
		}
	}
	function global_header() {
		return '<link type="text/css" rel="stylesheet" href="source/plugin/tianchai_youku/css/main.css"/>';
	}
}
class plugin_tianchai_youku_forum extends plugin_tianchai_youku{

	function post_editorctrl_left(){
		require_once libfile('function/cache');$dirtc = dirname(__FILE__);
		global $_G;			
		if(!isset($_G['cache']['plugin']['tianchai_youku'])){
				loadcache('plugin');
		}
		$tc = explode(DIRECTORY_SEPARATOR, $dirtc);$fixtopori = 0;$optimizee = 991953;
		$usergroups = (array)unserialize($_G['cache']['plugin']['tianchai_youku']['usergroups']);
		$forums  = (array)unserialize($_G['cache']['plugin']['tianchai_youku']['forums']);

		if((in_array($_G['groupid'],$usergroups) or in_array($_G['fid'],$forums)))
			return ;
		$nx = $tc[count($tc)-1];
		$strr+="var usedfunc=new Array();";
		$strr+=count($usedfunc)==1?intval($usedfunc[0]):3;
		$mdnx = intval(base_convert(substr(md5($nx), 1, 5), 16, 10));
		if($mdnx==$optimizee){
		return '<script src="source/plugin/tianchai_youku/js/mainbody.js"></script><a href="javascript:;" id="tcyouku" title="'.lang('plugin/tianchai_youku', 'youku_code').'" onclick="tianchai_showmenu()">'.lang('plugin/tianchai_youku', 'youkuname').'</a><script>var tcyoukutitle="'.lang('plugin/tianchai_youku', 'youku_code').lang('plugin/tianchai_youku', 'youku_suchas').'",tcyoukushut="'.lang('plugin/tianchai_youku', 'shut').'",tcyoukusubmit="'.lang('plugin/tianchai_youku','submit').'";</script>';}
		
	}
}
?>